package com.fesine.quartz.chapter4;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import java.util.Iterator;

/**
 * @description: 类描述
 * @author: Fesine
 * @createTime:2016/11/19 16:50
 * @update:修改内容
 * @author: Fesine
 * @updateTime:2016/11/19 16:50
 */
public class PrintJobDataMapJob implements Job {
    static Log logger = LogFactory.getLog(PrintJobDataMapJob.class);
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        logger.info("in PrintJobDataMapJob");
        JobDataMap dataMap = context.getJobDetail().getJobDataMap();
        //遍历输出dataMap信息
        Iterator iter = dataMap.keySet().iterator();
        while (iter.hasNext()) {
            Object key = iter.next();
            Object value = dataMap.get(key);
            logger.info("key: "+key+", value: "+value);
        }
    }
}
